package com.sskj.lib.bean;

import android.text.TextUtils;

import com.sskj.common.util.NumberUtil;

/**
 * 作者 :吕志豪
 * 简书：https://www.jianshu.com/u/6e525b929aac
 * github：https://github.com/lvzhihao100
 * 描述：
 * 创建时间：2018-07-30 10:28
 */
public class StockCoinBean {


    /**
     * code : BCH/USDT
     * name : BCH
     * date : 2018-12-24
     * time : 14:34:28
     * price : 203.9
     * cnyPrice : 1412.0075
     * open : 191
     * close : 203.9
     * high : 209.5
     * low : 188.15
     * volume : 384178.22189885
     * change : 12.9
     * changeRate : 6.75%
     * buy : 203.8
     * sell : 203.9
     */

    private String code;
    private String name;
    private String date;
    private String time;
    private String price;
    private String cnyPrice;
    private String open;
    private String close;
    private String high;
    private String low;
    private String volume;
    private String change;
    private String changeRate;
    private boolean isGreen;
    private boolean isLight = false;
    private String coin_img;

    public boolean isGreen() {
        return isGreen;
    }

    public String getCoin_img() {
        return coin_img;
    }

    public void setCoin_img(String coin_img) {
        this.coin_img = coin_img;
    }

    public StockCoinBean setGreen(boolean green) {
        isGreen = green;
        return this;
    }

    public boolean isLight() {
        return isLight;
    }

    public StockCoinBean setLight(boolean light) {
        isLight = light;
        return this;
    }

    public String getCode() {
        return code;
    }

    public StockCoinBean setCode(String code) {
        this.code = code;
        return this;
    }

    public String getName() {
        return name;
    }

    public StockCoinBean setName(String name) {
        this.name = name;
        return this;
    }

    public String getDate() {
        return date;
    }

    public StockCoinBean setDate(String date) {
        this.date = date;
        return this;
    }

    public String getTime() {
        return time;
    }

    public StockCoinBean setTime(String time) {
        this.time = time;
        return this;
    }

    public String getPrice() {
        return TextUtils.isEmpty(price) ? "0" : NumberUtil.keep4(price);
    }

    public StockCoinBean setPrice(String price) {
        this.price = price;
        return this;
    }

    public String getCnyPrice() {
//        return TextUtils.isEmpty(cnyPrice) ? "0" : NumberUtil.keep2(cnyPrice);
        return TextUtils.isDigitsOnly(cnyPrice) ? "0" : cnyPrice;
    }

    public StockCoinBean setCnyPrice(String cnyPrice) {
        this.cnyPrice = cnyPrice;
        return this;
    }

    public String getOpen() {
        return open;
    }

    public StockCoinBean setOpen(String open) {
        this.open = open;
        return this;
    }

    public String getClose() {
        return close;
    }

    public StockCoinBean setClose(String close) {
        this.close = close;
        return this;
    }

    public String getHigh() {
        return high;
    }

    public StockCoinBean setHigh(String high) {
        this.high = high;
        return this;
    }

    public String getLow() {
        return low;
    }

    public StockCoinBean setLow(String low) {
        this.low = low;
        return this;
    }

    public String getVolume() {
        return volume == null ? "0" : NumberUtil.keep4(volume);
    }

    public StockCoinBean setVolume(String volume) {
        this.volume = volume;
        return this;
    }

    public String getChange() {
        return change;
    }

    public StockCoinBean setChange(String change) {
        this.change = change;
        return this;
    }

    public String getChangeRate() {
        return changeRate.contains("-") ? changeRate : "+" + changeRate;
    }

    public StockCoinBean setChangeRate(String changeRate) {
        this.changeRate = changeRate;
        return this;
    }


}
